package com.cf.mvp.sample.mvp.model;

import com.cf.mvp.mvp.BaseModel;
import com.cf.mvp.sample.mvp.contract.MainContract;

public class MainModel extends BaseModel<MainContract.Presenter> implements MainContract.Model {

    @Override
    public void requestLogin(final String name, final String pwd) {
        new Thread(() -> {
            try {
                Thread.sleep(2 * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if ("admin".equals(name) && "123456".equals(pwd)) {
                getPresenter().requestSuccess("");
            } else {
                getPresenter().requestSuccess(null);
            }
        }).start();
    }
}
